package com.karina.visualization.chart.model;

import java.util.ArrayList;
import java.util.List;

public class ShapeModel<OB> extends DataModel<OB> {

	private int width;
	private int height;

	private int marginLeft;
	private int marginBottom;

	private int drawRegionWidth;
	private int drawRegionHeight;

	private int x;
	private int y;

	@Override
	protected DataModel<OB> copy(DataModel<OB> target) {
		ShapeModel<OB> shapeM = (ShapeModel<OB>) super.copy(target);

		shapeM.width = width;
		shapeM.height = height;
		shapeM.marginLeft = marginLeft;
		shapeM.marginBottom = marginBottom;
		shapeM.drawRegionWidth = drawRegionHeight;
		shapeM.drawRegionHeight = drawRegionHeight;
		shapeM.x = x;
		shapeM.y = y;

		return shapeM;
	}

	public void setMarginLeft(int marginLeft) {
		this.marginLeft = marginLeft;
	}

	public int getMarginLeft() {
		return marginLeft;
	}

	public void setMarginBottom(int marginBottom) {
		this.marginBottom = marginBottom;
	}

	public int getMarginBottom() {
		return marginBottom;
	}

	public void setWidth(int width) {
		this.width = width;
	}

	public int getWidth() {
		return width;
	}

	public void setHeight(int height) {
		this.height = height;
	}

	public int getHeight() {
		return height;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getX() {
		return x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}

	public void setDrawRegionWidth(int drawRegionWidth) {
		this.drawRegionWidth = drawRegionWidth;
	}

	public int getDrawRegionWidth() {
		return drawRegionWidth;
	}

	public void setDrawRegionHeight(int drawRegionHeight) {
		this.drawRegionHeight = drawRegionHeight;
	}

	public int getDrawRegionHeight() {
		return drawRegionHeight;
	}

	/**
	 * this interface is response to take the models of series which allows the
	 * UI container to generate a series of models and show the UI effect.
	 * 
	 * @param source
	 * @param target
	 * @param numSteps
	 * @return
	 */
	public List<ShapeModel<OB>> createSeriesModelSteps(ShapeModel<OB> target,
			int numSteps) {
		List<ShapeModel<OB>> serieses = new ArrayList<ShapeModel<OB>>();
		serieses.add(target);
		return serieses;
	}

	@Override
	protected DataModel<OB> createStepModel(DataModel<OB> t, double rate) {
		ShapeModel<OB> shapeM = (ShapeModel<OB>) super.createStepModel(t, rate);

		shapeM.width = width;
		shapeM.height = height;// (int) ((((ShapeModel<OB>) t).height - height)
								// * rate + height);

		shapeM.marginLeft = marginLeft;

		shapeM.marginBottom = marginBottom;

		shapeM.drawRegionWidth = drawRegionWidth;

		shapeM.drawRegionHeight = drawRegionHeight;

		shapeM.x = x;

		shapeM.y = y;

		return shapeM;
	}
}
